Ext.define("NotesApp.store.Notes", {
    extend: "Ext.data.Store",
    requires: "Ext.data.proxy.LocalStorage",
    config: {
        model: "NotesApp.model.Note",
        proxy: {
            type: 'localstorage',
            id: 'notes-app-store'
        },
        // 硬编码
//      data: [
//          { title: "记录 1", narrative: "描述 1" },
//          { title: "记录 2", narrative: "描述 2" },
//          { title: "记录 3", narrative: "描述 3" },
//          { title: "记录 4", narrative: "描述 4" },
//          { title: "记录 5", narrative: "描述 5" },
//          { title: "记录 6", narrative: "描述 6" }
//      ],
		// 排序
        sorters: [{ property: 'dateCreated', direction: 'DESC'}],
        // 分组
        grouper: {  
            sortProperty: "dateCreated",  
            direction: "DESC",  
            groupFn: function (record) {  
                if (record && record.data.dateCreated) {  
                    return record.data.dateCreated.toDateString();  
                } else {  
                    return '';  
                }  
            }  
        }, 
    }
});
